package stream;
import reference.Student;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author LiuYan
 * @date 2021/11/18 11:05
 */
public class Part06 {
    public static void main(String[] args) {
        List<Student> studentList = Arrays.asList(new Student(10, "zhangsan"),
                new Student(20, "lisi"),
                new Student(30, "wangwu"),
                new Student(40, "goudan"));
        // filter 中间操作：不会进行任何操作
        Stream<Student> studentStream = studentList.stream().filter(student -> student.getAge() > 10).skip(2).distinct().limit(1);
        // 终止操作：会进行以上操作（惰性操作）并且同一流不可以重复操作
        studentStream.forEach(System.out::println);






    }
}
